<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function show() {
        return new Promise((res, rej) => {
          let a = 5;
          setTimeout(() => {
            res(a);
          }, 2000);
        });
      }

      async function test() {
        let b = await show();
        console.log(b);
        console.log("ccc");
      }

      function show2() {
        return new Promise((res, rej) => {
          let a = 5;
          if (a == 5) {
            res(a);
          }
        });
      }

      async function test2() {
        let c = 6;
        let b;
        if (c == 6) {
          b = await show2();
          console.log("1");
        } else {
          b = await show2();
        }

        console.log("2");
        console.log("ccc");
      }

      test2(); //1,2,ccc
      // function show() {
      //   let a = 5;
      //   let b = 4;
      //   setTimeout(() => {
      //     console.log(a + b);
      //   }, 5000);

      //   console.log(a + b);
      // }
      // show();
    </script>
  </body>
</html>
